After a CIFS-enabled virtual server is configured, the virtual server is viewable on the Windows Network, but no data is shared yet. To share data, a CIFS share must be created. The share name must be unique for the virtual server. A CIFS share is a named access point in a volume that enables CIFS clients to view, browse, and manipulate files on a file server. To create a CIFS share, use the protocol cifs share new command. You can create up to 128 shares on a single CIFS-enabled virtual server.
A share is tied to the CIFS configuration of its virtual server and is deleted if either the virtual server or its CIFS configuration with which it is associated is removed from the system.
When you create a share, you specify the following information:
The CIFS-enabled virtual server on which the share is to be created.
The name of the CIFS share.
The directory path to the CIFS share. This path must exist in a volume. A directory path name can be up to 255 characters long. If there is a space in the path name, the entire string must be quoted (for example,"/new volume/mount here"). If this is a dynamic share, you can make the path name dynamic by specifying the %u (user name) or %d (domain name) variables as the value of this parameter. See the following item for a description of specifying a dynamic share.
Optionally, a list of properties for the share. The list can include one or more of the following:
dynamic-share—This specifies that the share name is dynamic. Specify this value with the dynamic-path option for a dynamic share. In a dynamic share, the share's name and path can be generated by substituting the user's name and domain with the %u and %d variables, respectively, specified as the value of the -share-name and -path parameters on the protocol cifs share new command when the share is created. For instance, if a dynamic share is defined with a name of %d_%u, a user logged on as barbara from a domain named FIN sees the share as FIN_barbara. Using the dynamic-share value specifies that the share name is dynamically expanded but the path name is not. For a full dynamic share, specify both the dynamic-path and the dynamic-share values.
dynamic-path—This specifies that the path name is dynamic. Specify this value with the dynamic-share option for a dynamic share. In a dynamic share, the share's name and path can be generated by substituting the user's name and domain with the %u and %d variables, respectively, as the value of the -path parameter on the protocol cifs shares new command when the share is created. For instance, if a dynamic share is defined as /user/%u, a user logged on as bill sees the path as /user/bill.
oplocks—This specifies that the share uses opportunistic locks, also known as client-side caching. Oplocks are enabled on shares by default; however, some applications do not work well when oplocks are enabled. In particular, database applications such as Microsoft Access are vulnerable to corruption when oplocks are enabled. An advantage of shares is that a single path can be shared multiple times, with each share having different properties. For instance, if a path named /dept/finance contains both a database and other types of files, you can create two shares to it, one with oplocks disabled for safe database access and one with oplocks enabled for client-side caching.
browsable—This specifies that the share is can be browsed by Windows clients. This is the default initial property for all shares.
Optionally, default UNIX mode bits for new files created on the share. If not specified, the mode bits default to 755.
Optionally, default UNIX mode bits for new directories created on the share. If not specified, the mode bits default to 755.
Accessing an existing directory or file through multiple CIFS shares that have different values for the file mode bits and directory-mode bits parameters returns consistent permissions and access right. For instance, assume you have a share named share1 that has file mode bits of 777 and a share named share2 that has file mode bits of 755, and that these shares overlap (that is, can access the same directories). If you create a file named \\server\share1\foo, the mode bits on that file are 777. If you create a file named \\server\share2\bar, the mode bits on that file are 755. If a user access the file named foo through the path \\server\share2\foo, the access permissions are 777; if a user accesses the file named bar through the path \\server\share1\bar, the access permissions are 755.
Optionally, a text description of the share. The description can be up to 255 characters long. If there is a space in the description, the entire string must be quoted (for example, "This is engineering's share.").
The following example creates a CIFS share named SHARE1 on a virtual server named vs1. Its directory path is /u/eng. Opportunistic locks and browsability are specified on the share, and UNIX mode bits are explicitly set as 775 on files and 777 on directories.
node::>protocol cifs share new -vserver vs0 -share-name SHARE1 -path /u/eng -share-properties browsable,oplocks -file-umask 775 -dir-umask 777
By default, the protocol cifs share show command displays the following information about CIFS shares:
Virtual server name
CIFS share name
Directory path
Share properties
Description, if applicable
Other information is displayed in a detailed view and if other parameters are specified. See the reference page for the command for details.
The following example displays information about all CIFS shares:
node::>protocol cifs share showVirtual Share Path Share Description Server Name Properties vs0 ADMIN$ / browsable - vs0 IPC$ / browsable - vs0 ROOTSHARE / browsable - vs1 ADMIN$ / browsable - vs1 IPC$ / browsable - vs1 ROOTSHARE / oplocks - browsable
By using the protocol cifs share modify command, you can modify the directory path, share properties, file mode bits, directory mode bits, and description of a CIFS share.
The following example modifies a CIFS share named DATA on a virtual server named vs1 to have the share properties oplocks and browsable:
node::>protocol cifs share modify -vserver vs1 -share-name DATA -share-properties oplocks,browsable
To delete a CIFS share, use the protocol cifs share delete command. Deleting a CIFS share does not delete the data that exists in the volume that the share accesses.
If you delete a CIFS-enabled virtual server, as described in “Deleting a Virtual Server”, the virtual server's CIFS configuration and any shares defined on the CIFS server are automatically deleted. Also, any Windows-to-UNIX name mappings defined for the virtual server are removed because they require both the CIFS and NFS servers. If a virtual server's CIFS configuration is deleted, the virtual server remains, but without CIFS support (including CIFS shares).
The following example deletes a CIFS share named SHARE1 from a virtual server named vs0:
node::>protocol cifs share delete -vserver vs0 -share-name SHARE1